package ace.module.oauth2.server.core.impl.converter.impl;

import ace.module.oauth2.server.core.impl.converter.Oauth2ObjectJsonConverter;
import ace.module.oauth2.server.core.impl.converter.TokenSettingsToJsonConverter;
import lombok.AllArgsConstructor;
import org.springframework.security.oauth2.server.authorization.settings.TokenSettings;
import org.springframework.stereotype.Component;

/**
 * @author caspar
 * @date 2023/10/12 11:50
 */
@AllArgsConstructor
@Component
public class TokenSettingsToJsonConverterImpl implements TokenSettingsToJsonConverter {
  private final Oauth2ObjectJsonConverter oAuth2ObjectJsonConverter;

  @Override
  public String convert(TokenSettings source) {
    return this.oAuth2ObjectJsonConverter.toJson(source.getSettings());
  }
}
